class Solution {
public:
    int get_left(vector<int>& nums, int target)
    {
        int left=0,right=nums.size()-1;

        while(left<right)
        {
            int mid=left+(right-left)/2;
            if(nums[mid]>=target)
            {
                right=mid;
            }
            else{
                left=mid+1;
            }
        }
        return left;
    }
    int get_right(vector<int>& nums, int target)
    {
        int left=0,right=nums.size()-1;

        while(left<right)
        {
            int mid=left+(right-left+1)/2;
            if(nums[mid]<=target)
            {
                left=mid;
            }
            else{
                right=mid-1;
            }
        }
        return left;        
    }
    vector<int> searchRange(vector<int>& nums, int target) {
        if(nums.empty())
        {
            return {-1,-1};
        }
        int left=get_left(nums,target);
        if(nums[left]!=target)
        {
            left=-1;
        }
        int right=get_right(nums,target);
        if(nums[right]!=target)
        {
            right=-1;
        }
        return {left,right};
    }
};
